package com.dly.blog.config;

import com.dly.blog.utile.SpringContextHolder;
import jakarta.annotation.PostConstruct;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

/**
 * @Author: DaiLiYu
 * @Date: 2023/7/17 15:41
 */
@Configuration
@AllArgsConstructor
public class SpringConfig {

    private final  ApplicationContext applicationContext;

    @PostConstruct
    public void getSpringContextHolder() {
        SpringContextHolder springContextHolder = SpringContextHolder.getInstance();
        springContextHolder.setApplicationContext(applicationContext);
    }
}
